<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="pragma" content="no-cache" />
	<link rel="stylesheet" href="/css/style.css" type="text/css"/>
	<script type="text/javascript" src="/js/jquery.js"></script>
	<script type="text/javascript" src="/js/util.js"></script>
</head>
<script type="text/javascript">
//////////////////////////////////////////////////////////////////////
////  email = "wenpin.qian@happyelements.com"                     ////
////  team = "Athene"                                             ////
////  warnings = "This is generated page,Do Not Modify!";         ////
////  tips = "Opera & IE not supported|Chrome & Safari sugguested"////
//////////////////////////////////////////////////////////////////////
window.returnValue=0;

$(document).ready(function() {
listselectors();
});

function additem_extra_prop() {
	var additem_extra_propUrl = "/item_extra_prop/add/";
	var levelValue = $("#level").val();
	if(!checkInteger("等级",levelValue,false)) {
		return;
	}
	var levelParam = "level=" + xparseInt(levelValue);
		
	var propertyValue = $("#property").val();
	
	var propertyParam = "property=" + propertyValue;
		
	var valueTypeValue = $("#valueType").val();
	
	var valueTypeParam = "valueType=" + valueTypeValue;
		
	var minValue = $("#min").val();
	if(!checkInteger("最大值",minValue,false)) {
		return;
	}
	var minParam = "min=" + xparseInt(minValue);
		
	var maxValue = $("#max").val();
	if(!checkInteger("最小值",maxValue,false)) {
		return;
	}
	var maxParam = "max=" + xparseInt(maxValue);
			
	$.ajax({
		   type: "POST",
		   url: additem_extra_propUrl,
		   data:   levelParam +'&'+ propertyParam +'&'+ valueTypeParam +'&'+ minParam +'&'+ maxParam ,
		   dataType: "json",
		   success: function(data) {
			   if(data.code > 0) {
			       window.returnValue=1;
			       beforeWindowClose();
				   window.close();
			   }else {
				  errDialog(data.message);
			   }
		   }
	});
}

function listselectors() {
}


function openResource(fieldname,dependfield) {
	var param = "";
	if(dependfield!="") {
		param = $("#" + dependfield).val()
		if(param == null || param == "") {
			alert("你先把【" + $("#lbl_" + dependfield).html() + "】填了再上传");
			return;
		}
	}
	resourceDialog("item_extra_prop",$("#" + fieldname).val(),param,function(result) {
		if(result != undefined && result != "") {
			$("#" + fieldname).val(result);
		}
	});
}

function beforeWindowClose() {
	if(window.returnCallback) {
		window.returnCallback(window.returnValue);
	}
	window.onbeforeunload = null;
	return true;
}

</script>
<body onunload="beforeWindowClose()">
	<div class="addarea">
	<form action="/item_extra_prop/add" method="post">
		<table>
			<tbody>				
					<tr>					<td>
						<label for="level" id="lbl_level">等级</label>
													<input type="text" id="level" name="level" /><span class="tips">[整数]</span>
											</td>
									
										<td>
						<label for="property" id="lbl_property">属性类型</label>
																				<select id="property" name="property">
								
									<option value="0">无</option>
								
									<option value="1">血</option>
								
									<option value="2">攻击</option>
								
									<option value="3">防御</option>
								
									<option value="4">重击</option>
								
									<option value="5">爆击</option>
								
									<option value="6">伤害减免值</option>
								
									<option value="7">伤害增加值</option>
								
									<option value="8">伤害减免百分比</option>
								
									<option value="9">伤害增加百分比</option>
								
									<option value="10">精力值</option>
															</select>
											</td>
					</tr>				
					<tr>					<td>
						<label for="valueType" id="lbl_valueType">值类型</label>
																				<select id="valueType" name="valueType">
								
									<option value="0">数值</option>
								
									<option value="1">百分比</option>
															</select>
											</td>
									
										<td>
						<label for="min" id="lbl_min">最大值</label>
													<input type="text" id="min" name="min" /><span class="tips">[整数]</span>
											</td>
					</tr>				
					<tr>					<td>
						<label for="max" id="lbl_max">最小值</label>
													<input type="text" id="max" name="max" /><span class="tips">[整数]</span>
											</td>
												</tbody>
		</table>
		<input type="button" onclick="additem_extra_prop()" value="添加"/>
	</form>
	</div>
</body>